/*    */ package com.wgcloud.service;
/*    */ 
/*    */ import com.github.pagehelper.PageHelper;
/*    */ import com.github.pagehelper.PageInfo;
/*    */ import com.wgcloud.entity.LogInfo;
/*    */ import com.wgcloud.mapper.LogInfoMapper;
/*    */ import com.wgcloud.util.DateUtil;
/*    */ import com.wgcloud.util.UUIDUtil;
/*    */ import java.util.HashMap;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import org.slf4j.Logger;
/*    */ import org.slf4j.LoggerFactory;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Service;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ @Service
/*    */ public class LogInfoService
/*    */ {
/* 29 */   private static final Logger logger = LoggerFactory.getLogger(com.wgcloud.service.LogInfoService.class);
/*    */   
/*    */   public PageInfo selectByParams(Map<String, Object> params, int currPage, int pageSize) throws Exception {
/* 32 */     PageHelper.startPage(currPage, pageSize);
/* 33 */     List<LogInfo> list = this.logInfoMapper.selectByParams(params);
/* 34 */     PageInfo<LogInfo> pageInfo = new PageInfo(list);
/* 35 */     return pageInfo;
/*    */   } @Autowired
/*    */   private LogInfoMapper logInfoMapper;
/*    */   public void saveRecord(List<LogInfo> recordList) throws Exception {
/* 39 */     if (recordList.size() < 1) {
/*    */       return;
/*    */     }
/* 42 */     Map<String, Object> map = new HashMap<>();
/* 43 */     for (LogInfo as : recordList) {
/* 44 */       as.setId(UUIDUtil.getUUID());
/* 45 */       as.setCreateTime(DateUtil.getNowTime());
/*    */     } 
/* 47 */     this.logInfoMapper.insertList(recordList);
/*    */   }
/*    */   
/*    */   public void save(String hostname, String infoContent, String state) {
/* 51 */     LogInfo logInfo = new LogInfo();
/* 52 */     logInfo.setHostname(hostname);
/* 53 */     logInfo.setInfoContent(infoContent);
/* 54 */     logInfo.setState(state);
/* 55 */     logInfo.setId(UUIDUtil.getUUID());
/* 56 */     logInfo.setCreateTime(DateUtil.getNowTime());
/*    */     try {
/* 58 */       this.logInfoMapper.save(logInfo);
/* 59 */     } catch (Exception e) {
/* 60 */       logger.error("保存日志信息异常：", e);
/*    */     } 
/*    */   }
/*    */   
/*    */   public int countByParams(Map<String, Object> params) throws Exception {
/* 65 */     return this.logInfoMapper.countByParams(params);
/*    */   }
/*    */   
/*    */   public int deleteById(String[] id) throws Exception {
/* 69 */     return this.logInfoMapper.deleteById(id);
/*    */   }
/*    */   
/*    */   public LogInfo selectById(String id) throws Exception {
/* 73 */     return this.logInfoMapper.selectById(id);
/*    */   }
/*    */   
/*    */   public List<LogInfo> selectAllByParams(Map<String, Object> params) throws Exception {
/* 77 */     return this.logInfoMapper.selectAllByParams(params);
/*    */   }
/*    */   
/*    */   public int deleteByDate(Map<String, Object> map) throws Exception {
/* 81 */     return this.logInfoMapper.deleteByDate(map);
/*    */   }
/*    */ }


/* Location:              /Users/zhangyongxin/soft-install/wgcloud/wgcloud-v3.3.5/server/bank/wgcloud-server-release.jar!/BOOT-INF/classes/com/wgcloud/service/LogInfoService.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */